import java.util.ArrayList;
import java.util.Collections;
// BM48 数据流中的中位数
public class Heap {

    private ArrayList<Integer> array = new ArrayList<>();

    public void Insert(Integer num) {
        array.add(num);
    }
    public Double GetMedian() {
        Collections.sort(array);
        if (array.size()%2==0) {
            int index1 = array.size()/2-1;
            int index2 = array.size()/2;
            return (array.get(index1)+array.get(index2))/2.0;
        } else {
            return array.get(array.size()/2)*0.1;
        }
    }


}